#ifndef _USE_MATH_FILTERS
#define _USE_MATH_FILTERS

#include <stdlib.h>
#include <math.h>

typedef enum
{
    OriginImage,      //原图
    Classics,         //经典
    BlackAndWhite,    //黑白
    Cloud,           //云端
    MigratoryBird,    //候鸟
    PhotographicPlate, //底片
    Relief,           //浮雕
    QuietlyElegant     //淡雅
}
FilterType;


bool getFilters(void* ImageSrcData, void* ImageFilterData, int width, int height, FilterType filerType,int ImageType);



class IFilter
{
public:
    IFilter(){}
    virtual ~IFilter() { };
    virtual void Init(void* pInfo) { }; //”√”⁄…Ë÷√≤Œ ˝
    virtual void Reset() { };
    
    virtual bool Filter(void* pSrc, void* pDest, int width, int height, int bpp)  //CONST void far    LPCVOID
    {
        return false;
    }
};

unsigned long  GaussBlurThreadProc8(void* lpParameters);

unsigned long  GaussBlurThreadProc24(void* lpParameters);

//
// ¥´µ›µΩœﬂ≥Ãµƒ≤Œ ˝
//
//template<typename T>
class CGaussBlurThreadParams
{
public:
    int r;
    float* pTempl;
    unsigned char* pSrc;	//Src  ŒªÕºµƒŒªÕº ˝æ›∆µ„ £®∂‘À˘”–œﬂ≥Ã£¨pSrc£¨pDest  «œ‡Õ¨µƒ£©
    unsigned char* pDest;	//Dest ŒªÕºµƒŒªÕº ˝æ›∆µ„
    
    int width;		//ÕºœÒøÌ∂»
    int height;		//ÕºœÒ∏ﬂ∂»£®“—æ≠±ª»°æ¯∂‘÷µ£©
    
    //¥¶¿Ìµƒ––∑∂Œß£∫[rowBegin, rowEnd) £¨≤ª∞¸¿® rowEnd £®√ø∏ˆœﬂ≥Ã≤ªÕ¨£©
    int rowBegin;
    int rowEnd;
    int stride;		//…®√Ë––øÌ∂»£®bytes£©
    int pixelSize;	//œÒÀÿ¥Û–° =bpp/8;
    
    bool bHorz;		//true-ÀÆ∆Ωƒ£∫˝£¨false-◊›œÚƒ£∫˝
    
public:
    CGaussBlurThreadParams() { };
    ~CGaussBlurThreadParams() { };
};


//
// ∏ﬂÀπƒ£∫˝À„∑®
//
class CGaussBlurFilter : public IFilter
{
protected:
    int m_r;		//ÕÍ’˚ƒ£∞Â’˝∑Ω–Œµƒ±ﬂ≥§Œ™ (2 * r + 1)
    //T m_sigma;		//∏ﬂÀπ∞Îæ∂£®∑Ω≤Óµƒ∆Ω∑Ω∏˘£©
    float m_sigma;
    //T* m_pTempl;	//ƒ£∞ÂT[r+1];
    float* m_pTempl;	//ƒ£∞ÂT[r+1];
    
public:
    CGaussBlurFilter();
    virtual ~CGaussBlurFilter();
    
    //…Ë÷√≤Œ ˝£®¥À ±ª·∑÷≈‰ƒ£∞Â£©
    void SetSigma(float sigma);
    
    //…Ë÷√≤Œ ˝
    virtual void Init(void* pInfo);
    
    // Õ∑≈ƒ£∞Â
    virtual void Reset();
    
    //¥¶¿ÌÕºœÒ
    virtual bool Filter(void* pSrc, void* pDest, int width, int height, int bpp);
};

#endif